//
//  QCHeightController.swift
//  爱汽车
//
//  Created by liujianlong on 2023/8/24.
//

import UIKit
///低趴预置位
struct PrePos{
    var name:String
    var num:Int
}
///带LOW档的预置位数组
let PrePosArray_5 : [PrePos] = [PrePos(name: "LOW", num: 5),
                                PrePos(name: "1", num: 1),
                                PrePos(name: "2", num: 2),
                                PrePos(name: "3", num: 3),
                                PrePos(name: "4", num: 4)]
///不带LOW档的预置位数组
let PrePosArray_4 : [PrePos] = [PrePos(name: "1", num: 1),
                                PrePos(name: "2", num: 2),
                                PrePos(name: "3", num: 3),
                                PrePos(name: "4", num: 4)]

class QCHeightController: QCViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        initUI()
    }
    
    override func initUI() {
        title = LS("高度记忆设置")
        tableView.delegate = self
        tableView.dataSource = self
        tableView.register(QCSettingCell.nib(), forCellReuseIdentifier: QCSettingCell.ID())
        tableView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }
}
//MARK: - UITableViewDataSource
extension QCHeightController:UITableViewDataSource
{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return PrePosArray_5.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: QCSettingCell.ID()) as! QCSettingCell
        cell.title.text = LS(PrePosArray_5[indexPath.row].name)
        cell.type = .onlyText("")
        return cell
    }
}
//MARK: - UITableViewDelegate
extension QCHeightController:UITableViewDelegate{
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let prepos = PrePosArray_5[indexPath.row]
        if prepos.name == "LOW"{
            let vc = QCLowController()
            vc.prepos = prepos
            push(vc,true)
        }else{
            let vc = QCCustomController()
            vc.prepos = prepos
            push(vc,true)
        }
    }
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 0
    }
    
    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
        return 0
    }
    
    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        return nil
    }
    
    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
        return nil
    }
}
